using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityTemplateProjects;
using DG.Tweening;
using Cinemachine;
using UnityEngine.Rendering.Universal;


public class Login : MonoBehaviour
{
    private Button PlaytBtn;
    private Button ExitBtn;
    public bool IsLoginPanal = true;
    public GameObject tips;
    public SimpleCameraController cameraController;
    [SerializeField]
    private float ShakeSpeed;
    [SerializeField]
    private float ShakeStrength;
    [SerializeField]
    private int ShakeVibrato;
    [SerializeField]
    private float ShakeRandomness;
    [SerializeField]
    private bool ShakeFadeOut;
    // Start is called before the first frame update
    void Start()
    {
        cameraController =GameObject.Find("Main").GetComponent<SimpleCameraController>();
        cameraController.enabled=false;

       
        tips.gameObject.SetActive(true);
        PlaytBtn = this.transform.Find("Begin").GetComponent<Button>();
        ExitBtn = this.transform.Find("Exit").GetComponent<Button>();
    }

    // Update is called once per frame
    void Update()
    {
      //  Camera.main.transform.DOShakeRotation(ShakeSpeed, ShakeStrength, ShakeVibrato, ShakeRandomness);
       
        if (IsLoginPanal)
        {
            Plants.IsPlants = false;
            PlaytBtn.onClick.AddListener(PlayingGame);
            ExitBtn.onClick.AddListener(ExitGame);

        }
       
    }

    private void FixedUpdate()
    {
        Camera.main.transform.DOShakePosition(ShakeSpeed, ShakeStrength, ShakeVibrato, ShakeRandomness);
    }
    void PlayingGame()
    {
        this.gameObject.SetActive(false);
       
        Plants.IsPlants = true;

        cameraController.enabled = true;

        tips.gameObject.SetActive(true);
       
    }
    void ExitGame()
    {
        Application.Quit();
    }
   
}
